const viewerInit = function(){
    const viewer = new Cesium.Viewer('cesiumContainer', {
        baseLayerPicker: false,   //图层选择器
        animation: false,   //左下角仪表
        fullscreenButton: false,   //全屏按钮
        geocoder: false,   //右上角查询搜索
        infoBox: false,   //信息框
        homeButton: false,   //home按钮
        sceneModePicker: false,  //3d 2d选择器
        selectionIndicator: false,  //
        timeline: false,   //时间轴
        navigationHelpButton: false,  //右上角帮助按钮
        skyBox: new Cesium.SkyBox({
			sources: {
				positiveX: 'data/images/skybox/px.jpg',
				negativeX: 'data/images/skybox/mx.jpg',
				positiveY: 'data/images/skybox/py.jpg',
				negativeY: 'data/images/skybox/my.jpg',
				positiveZ: 'data/images/skybox/pz.jpg',
				negativeZ: 'data/images/skybox/mz.jpg',
			},
		}),
        imageryProvider: new Cesium.TileMapServiceImageryProvider({
          url: Cesium.buildModuleUrl("Assets/Textures/NaturalEarthII"),
        })
    })
    //浅拷贝
    window.viewer = viewer;
    viewer.cesiumWidget.creditContainer.style.display="none";
    //viewer.scene.debugShowFramesPerSecond = true;
    //viewer.resolutionScale
    if(!window.isOnline){
        let image = new Cesium.WebMapServiceImageryProvider({
            url:"http://36.112.11.166:8310/tilecache/service/wms",
            layers: `image_globle_base-JPEG-4326`,
            parameters: {
                service: 'WMS',
                format: 'image/png',
                style: "default"
            },
            //tileWidth: 256,
            //tileHeight: 256,
            srs: "EPSG:4326"
        })
        let gugeLabel = new Cesium.WebMapServiceImageryProvider({
            url:"http://36.112.11.166:8310/tilecache/service/wms",
            layers: `image_globle_base-JPEG-4326`,
            parameters: {
                service: 'WMS',
                format: 'image/png',
                style: "default"
            },
            //tileWidth: 256,
            //tileHeight: 256,
            srs: "EPSG:4326"
        })
      
        viewer.imageryLayers.addImageryProvider(image)
        viewer.imageryLayers.addImageryProvider(image)
        //地形
        // window.dx = new Cesium.CesiumTerrainProvider({
        //     url:'https://www.supermapol.com/realspace/services/3D-stk_terrain/rest/realspace/datas/info/data/path',
        //     requestWaterMask:false ,
        //     requestVertexNormals: false
        // })
        // viewer.scene._terrainExaggeration = 1.5
        // viewer.terrainProvider = window.dx
    }else{
        //影像
        viewer.imageryLayers.addImageryProvider(
            new Cesium.WebMapTileServiceImageryProvider({
                url: window.baseLayer.url,
                layer: window.baseLayer.layer,
                style: window.baseLayer.style,
                format: window.baseLayer.format,
                tileMatrixSetID: window.baseLayer.tileMatrixSetID,
                tilingScheme: new Cesium.GeographicTilingScheme()
            })
        )
        //地名
        viewer.imageryLayers.addImageryProvider(
            new Cesium.WebMapTileServiceImageryProvider({
                url: window.labelLayer.url,
                layer: window.labelLayer.layer,
                style: window.labelLayer.style,
                format: window.labelLayer.format,
                tileMatrixSetID: window.labelLayer.tileMatrixSetID,
                tilingScheme: new Cesium.GeographicTilingScheme()
            })
        )
        //地形
        window.dx = new Cesium.CesiumTerrainProvider({
            url: window.terrainUrl,
            requestWaterMask:true,
            requestVertexNormals: true
        })
        viewer.terrainProvider = window.dx
        viewer.scene._terrainExaggeration = 1.5
    }
}
export default  viewerInit;